<?php

namespace App\Models;

use App\Scopes\IsDelScope;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Request;
use Laravel\Sanctum\HasApiTokens;

class DoctorModel extends BaseModel {

    protected static function booted()
    {
        parent::booted();
    }

    protected $table = "dtrd_ent_rd_doctor";
    protected $primaryKey = "data_id";

    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->connection = Request::header('Environment') ?: 'oms_prod';
    }

    public function user()
    {
        return $this->hasOne(SysUserModel::class, 'phone', 'doctors_mobile');
    }
}
